<template>		
<view class="">
	<view class="info">
		<!-- 君子之学，博于外而尤贵精于内，论诸理而尤贵达于事! -->
		<marquee direction="left"
		         behavior="scroll"
		         scrollamount="5px">
		    君子之学，博于外而尤贵精于内，论诸理而尤贵达于事!
		</marquee>
		</view>
		<view class="warp">
			<view class="item" v-for="(item,index) in listData" :key="index" @tap="goList(item)">
				<image :src="item.imgurl" mode="" class="itemImg"></image>
				<h4 class="title">{{item.title}}</h4>
				<span class="detail">{{item.content}}</span>
			</view>
		</view>
</view>

</template>

<script>
	import { selectMenu } from "@/api/index.js"
	export default {
		data() {
			return {
				listData: [
					{
						title: "每日打卡",
						content: "十年如一日的坚持，是对自己最好的馈赠",
						imgurl: 'https://longyugou.top:8008/icon/ill/ad.png'
					},
					{
						title: "黄金屋",
						content: "君子之学也，入乎耳，著乎心，布乎四体，形乎动静",
						imgurl: 'https://longyugou.top:8008/icon/ill/pay.png'
					},
					{
						title: "习惯库",
						content: "人虽禀定性,必须博学以成其道",
						imgurl: 'https://longyugou.top:8008/icon/ill/run.png'
					},
					{
						title: "兴趣坊",
						content: "人虽禀定性,必须博学以成其道",
						imgurl: 'https://longyugou.top:8008/icon/ill/talk.png'
					}
				]
			}
		},
		onLoad() {
			this.selectMenus()
			this.$store.commit("unit")
		},
		methods: {
			goList(data) {
				console.log(data);
				uni.navigateTo({
					url: "/pages/list/list?level=" + encodeURIComponent(JSON.stringify(data.level))
				})
			},
			async selectMenus(){
				let res = await selectMenu();
				this.listData = res.data
			}
		}
	}
</script>

<style scoped>
	page {
		background-color: aliceblue;
	}
	.info {
		padding: 10rpx;
		background-color: #fff;
		margin-bottom: 10rpx;
		font-size: 0.8rem;
		color: #cfb9b9;
	}
	.warp {
		padding: 20rpx;
		display: flex;
		justify-content: space-around;
		flex-flow: wrap;
	}
	.item {
		width: 45%;
		background-color: #fff;
		overflow: hidden;
		align-items: center;
		text-align: center;
		margin-bottom: 30rpx;
		padding-bottom: 20rpx;
	}
	.itemImg {
		width: 100%;
		max-height: 300rpx;
	}
	.title {
		color: #e4203a;
	}
	.detail {
		text-align: left;
		color: #cfb9b9;
		overflow : hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 1;      /* 可以显示的行数，超出部分用...表示*/
		-webkit-box-orient: vertical;
	}
</style>